/*
 * 统计输入数据中的字符数、行数、单词数并输出到屏幕
 */

#include <stdio.h>

#define IN 1
#define OUT 0

int main() {
    int c, nc, nw, nl, state;

    state = OUT;
    nc = nw = nl = 0;
    while ((c = getchar()) != EOF) {
        nc++;

        if (c == '\n') nl++;

        if (c == ' ' || c == '\t' || c == '\n') {
            state = OUT;
        } else if (state == OUT) {
            nw++;
            state = IN;
        }
    }

    printf("nl: %d nw: %d nc: %d\n", nl, nw, nc);

    return 0;
}
